/**
 * Created by root on 16-12-30.
 */

jQuery(function () {
    table_num();
})

/*
jQuery(function () {
    var currentTime = Date.parse(new Date());
    $('tbody').find('tr').each(function () {
        var reportTime = $(this).children('#td_reportTime').text();
        reportTime = Date.parse(new Date(reportTime));
        var intervalTime = currentTime - reportTime;
        if(intervalTime < 300000){
            $(this).children("#td_statu").html('<strong style="font-size: 11px; background-color: green;color: white;padding: 0px 5px;" class="btn">在线</strong>')
        }else{
            $(this).children("#td_statu").html('<strong style="font-size: 11px; background-color: red;color: white;padding: 0px 5px;" class="btn">离线</strong>')
        }
    })
})
*/

jQuery(function () {
    $.get({
        'url':'/assets/getTime/',
        'success':function (callback) {
            var currentTime = Date.parse(new Date(callback));
            $('tbody').find('tr').each(function () {
                var reportTime = $(this).children('#td_reportTime').text();
                reportTime = Date.parse(new Date(reportTime));
                var intervalTime = currentTime - reportTime;
                if(intervalTime < 120000){
                    $(this).children("#td_statu").html('<strong style="font-size: 11px; background-color: green;color: white;padding: 0px 5px;" class="btn">在线</strong>')
                }else{
                    $(this).children("#td_statu").html('<strong style="font-size: 11px; background-color: red;color: white;padding: 0px 5px;" class="btn">离线</strong>')
                }
            })
        }
    })
})

function details(this_id){
    var main_ip = $(this_id).parent().parent().children('#td_main_ip').text();
    window.open('/assets/serverDetails?ip='+main_ip);
}
